package ylg.com.cn.beuty.main.fragment.fragment_home;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;

import ylg.com.cn.beuty.R;
import ylg.com.cn.beuty.main.adapter.NoticePagerAdapter;
import ylg.com.cn.beuty.utils.Tools;
import ylg.com.cn.beuty.widget.MyListView;
import ylg.com.cn.beuty.widget.RunViewPager;

/**
 * Created by MyPC on 2017/1/14.
 */
public class VideoFrament extends Fragment {

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    private Context context;
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        context = getActivity();
        return inflater.inflate(R.layout.fragment_video,container,false);
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        findView(view);
        initData();
        scrollView.smoothScrollTo(0, 0);
       // Tools.showDialog(getActivity());

    }

    private RunViewPager runviewpager;
    private LinearLayout dot_ly;
    private MyListView new_video;
    private MyListView recommend_people;
    private MyListView recommend_video;
    private ScrollView scrollView;

    private void findView(View view){
        runviewpager = (RunViewPager) view.findViewById(R.id.runviewpager);
        dot_ly = (LinearLayout) view.findViewById(R.id.dot_ly);
        new_video = (MyListView) view.findViewById(R.id.new_video);
        recommend_people = (MyListView) view.findViewById(R.id.recommend_people);
        recommend_video = (MyListView) view.findViewById(R.id.recommend_video);
        scrollView = (ScrollView) view.findViewById(R.id.scrollView);
    }

    private  int[] imgaes ;
    private NoticePagerAdapter noticePagerAdapter;
    private void initData() {
        imgaes = new int[]{
                R.mipmap.cover1, R.mipmap.cover2, R.mipmap.cover3, R.mipmap.cover4
        };
        noticePagerAdapter = new NoticePagerAdapter(getContext(), imgaes);
        runviewpager.setAdapter(noticePagerAdapter);
    }


}
